package com.energy.analysis.sys.entity;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.builder.CompareToBuilder;
import com.energy.analysis.comm.base.BaseEntity;


/** 
* @ClassName: Menu 
* @Description: TODO(这里用一句话描述这个类的作用) 
* @author A18ccms a18ccms_gmail_com 
* @date 2015年9月8日 上午10:54:23 
*  
*/
public class Menu extends BaseEntity implements Comparable<Menu>{

	/**
	 * serialVersionUID:TODO(用一句话描述这个变量表示什么).
	 * 
	 * @since JDK 1.8
	 */
	private static final long serialVersionUID = 1L;

	private String menuId;
	private String menuCode;
	private String menuName;
	private String menuUrl;
	private String menuPid;
	private Integer menuOrder;
	private String menuSts;
	private String rmk;
	private String isLeaf;
	private String icon;
	
	/** 对应菜单set */
	private Set<String> menuItems = new HashSet<String>(0);
	/** 对应菜单 */
	private List<MenuItem> menuItemList = new ArrayList<MenuItem>(0);

	/* (非 Javadoc) 
	* <p>Title: equals</p> 
	* <p>Description: </p> 
	* @param obj
	* @return 
	* @see java.lang.Object#equals(java.lang.Object) 
	*/
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Menu other = (Menu) obj;
		if (menuId == null) {
			if (other.menuId != null)
				return false;
		} else if (!menuId.equals(other.menuId))
			return false;
		return true;
	}

	/** 
	 * @return icon 
	 */
	public String getIcon() {
		return icon;
	}

	public String getIsLeaf() {
		return isLeaf;
	}

	public boolean isLeaf() {
		return "1".equals(isLeaf);
	}

	public String getMenuCode() {
		return menuCode;
	}

	public String getMenuId() {
		return menuId;
	}

	public List<MenuItem> getMenuItemList() {
		return menuItemList;
	}

	public Set<String> getMenuItems() {
		return menuItems;
	}

	public String getMenuName() {
		return menuName;
	}

	public Integer getMenuOrder() {
		return menuOrder;
	}

	public String getMenuPid() {
		return menuPid;
	}

 

	public String getMenuSts() {
		return menuSts;
	}

	public String getMenuUrl() {
		return menuUrl;
	}

	public String getRmk() {
		return rmk;
	}

	/* (非 Javadoc) 
	* <p>Title: hashCode</p> 
	* <p>Description: </p> 
	* @return 
	* @see java.lang.Object#hashCode() 
	*/
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((menuId == null) ? 0 : menuId.hashCode());
		return result;
	}

	/** 
	 * @param icon 要设置的 icon 
	 */
	public void setIcon(String icon) {
		this.icon = icon;
	}

	public void setIsLeaf(String isLeaf) {
		this.isLeaf = isLeaf;
	}

	public void setMenuCode(String menuCode) {
		this.menuCode = menuCode;
	}

	public void setMenuId(String menuId) {
		this.menuId = menuId;
	}

	public void setMenuItemList(List<MenuItem> menuItemList) {
		this.menuItemList = menuItemList;
	}

	public void setMenuItems(Set<String> menuItems) {
		this.menuItems = menuItems;
	}

	public void setMenuName(String menuName) {
		this.menuName = menuName;
	}

	public void setMenuOrder(Integer menuOrder) {
		this.menuOrder = menuOrder;
	}

	public void setMenuPid(String menuPid) {
		this.menuPid = menuPid;
	}

	public void setMenuSts(String menuSts) {
		this.menuSts = menuSts;
	}

	
	public void setMenuUrl(String menuUrl) {
		this.menuUrl = menuUrl;
	}

	public void setRmk(String rmk) {
		this.rmk = rmk;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Menu [menuId=");
		builder.append(menuId);
		builder.append(", menuCode=");
		builder.append(menuCode);
		builder.append(", menuName=");
		builder.append(menuName);
		builder.append(", menuUrl=");
		builder.append(menuUrl);
		builder.append(", menuPid=");
		builder.append(menuPid);
		builder.append(", menuOrder=");
		builder.append(menuOrder);
		builder.append(", menuSts=");
		builder.append(menuSts);
		builder.append(", rmk=");
		builder.append(rmk);
		builder.append(", isLeaf=");
		builder.append(isLeaf);
		builder.append(", icon=");
		builder.append(icon);
		builder.append(", menuItems=");
		builder.append(menuItems);
		builder.append(", menuItemList=");
		builder.append(menuItemList);
		builder.append("]");
		return builder.toString();
	}

	@Override
	public int compareTo(Menu o) {
		 return new CompareToBuilder().append(menuId, o.menuId).toComparison();
	}

	 
}